<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>江西软云科技</title>
    <link rel="stylesheet" href="__STATIC__/TK/css/index.css">
    <style>
        .login .logininput .container select {
            position: absolute;
            width: 3.63rem;
            height: 0.45rem;
            top: 50%;
            left: 50%;
            margin-left: -1.765rem;
            margin-top: -0.2rem;
            border-radius: 0.3rem;
            outline: none;
            border: 0.01rem solid #DDDDDD;
            padding-left: 0.1rem;
            color: #5B5B61;
        }
        .layui-layer-btn a{
            font-size: 16px;
        }
        .layui-layer-dialog{
            height: 160px;
        }
    </style>
</head>
<body>
<div class="tk-demo-theme">
    <!--登录界面-->
    <div id="login" class="login">
        <div class="loginbg"></div>
        <div class="logininput">
            <div class="container">
                <!--<div><input id="ihost" type="text" placeholder="   URL" value="global.talk-cloud.net"></div>-->
                <!--<div><input id="ikey" type="text" placeholder="   CompanyKey" value="Z83ClPXSEcIjDAPZ"></div>-->
                <div><input id="iserial" type="text" placeholder="   房间号 (必填)" value="" ></div>
                <div><input id="ipassword" type="text" placeholder="   密码 (必填)" value="" ></div>
                <div><input id="inick" type="text" placeholder="   昵称 (必填)" value="" ></div>
                <div>
                    <select id="iusertype">
                        <option value="主讲(老师)">   主讲(老师)</option>
                        <option value="助教">   助教</option>
                        <option value="学员" selected>   学员</option>
                        <option value="直播用户">   直播用户</option>
                        <option value="巡检员">   巡检员</option>
                    </select>
                </div>
            </div>
            <button id="loginbtn" class="loginbtn">进入教室</button>
        </div>
        <div class="logininfo">请登录企业管理系统（<a href="http://global.talk-cloud.net/User/login.html">http://global.talk-cloud.net/User/login.html</a>）创建房间，将房间号及密码填入相应输入框后加入房间</div>

    </div>

    <iframe style="width: 100%; height: 100%; display: none" src="#" id="zhiboframe"></iframe>



</div>
</body>
</html>
<script src="__JS__/jquery.js"></script>
<script src="__JS__/layui/layui.all.js"></script>
<script type="text/javascript">
    // 登录页点击进入房间
    document.getElementById('loginbtn').onclick = loginTrigger;
    // 加入房间触发事件
    function loginTrigger (){
//        var host = document.getElementById('ihost');
        var serial = document.getElementById('iserial');
        var password = document.getElementById('ipassword');
        var nick = document.getElementById('inick');
        var usertype = document.getElementById('iusertype');
        joinRoom(serial.value,password.value,nick.value,usertype.value);
//        serial.value = password.value = nick.value='';
    };

    function joinRoom(serial,password,nick,usertype) {
        if (serial === '') {
            layer.open({title  : '错误', icon   : 5, content: '请输入房间号'});
            return;
        }
        if (password === '') {
            layer.open({title  : '错误', icon   : 5, content: '请输入房间密码'});
            return;
        }
        if (nick === '') {
            layer.open({title  : '错误', icon   : 5, content: '请输入您的昵称'});
            return;
        }

        var data = {
            serial: serial,
            password : password,
            nick : nick,
            role         : usertype
        };
        $.post("{:url('index/Talk_login/login')}", data, function(rs){
            if(rs.state == 0){
                layer.open({
                    title  : '错误',
                    icon   : 5,
                    content: rs.msg
                });
            }else{
                location.href=rs.url;
//                $("#login").hide();
//                $("#zhiboframe").show();
//                $("#zhiboframe",parent.document.body).attr("src",rs.url)
            }
        })



        //        var form = document.createElement("form");
//        document.body.appendChild(form);
//        var serial = generateHideElement("serial", serial),
//            password = generateHideElement("password", password),
//            nick = generateHideElement("nick", nick),
//            role = generateHideElement("role", usertype);
//            form.appendChild(serial);
//            form.appendChild(password);
//            form.appendChild(nick);
//            form.appendChild(role);
//            form.method = "post";
//            form.action = "{:url('index/Talk_login/login')}";
//            form.submit();
//        var generateHideElement = function (name, value) {
//            var tempInput = document.createElement("input");
//            tempInput.type = "hidden";
//            tempInput.name = name;
//            tempInput.value = value;
//            return tempInput;
//        }
    };



</script>
<!--<script src="__STATIC__/TK/sdk/tksdk.js" language="JavaScript"></script>-->
<!--<script src="__STATIC__/TK/js/createDom.js" language="JavaScript"></script>-->
<!--<script src="__STATIC__/TK/js/controller.js" language="JavaScript"></script>-->
<!--<script src="__STATIC__/TK/js/chat.js" language="JavaScript"></script>-->
<!--<script src="__STATIC__/TK/js/equipment.js" language="JavaScript"></script>-->